package test;

import javax.swing.*;
import java.awt.*;

/**
 * @Author leiHua
 * @Date 2022/5/26 22:47
 */
public class comBox {
    public static void main(String[] args) {
        JFrame jFrame = new JFrame();
        jFrame.setLayout(null);
        String []dayStr=new String[32];
        dayStr[0]="日期";
        for (int i = 1; i <32; i++) {
            dayStr[i]=String.valueOf(i);
        }
        JComboBox<String> dayBox = new JComboBox<>(dayStr);
        dayBox.setBounds(500,250,100,40);
        dayBox.setFont(new Font("宋体",Font.TYPE1_FONT,20));
        jFrame.add(dayBox);
        String day = dayBox.getSelectedItem().toString();
        System.out.println(day);
        jFrame.setVisible(true);
        jFrame.setSize(1000,1000);
    }
}
